﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Demo.Services.Services.Impl.Managers;
using Demo.CommonBase.Logging;
using Demo.CommonBase.Exceptions;
using System.Reflection;
using Ext.Net;
using Demo.Services.Contracts.DTO.Infos;
using Demo.CommonBase.View.Forms;

namespace Demo.Web.Grafics
{
    public partial class ResourceGraphicView : PageBase
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                GetResourceAssignment();
            }
        }
        protected void GetResourceAssignment()
        {

            Demo.Services.Services.Impl.Managers.ResourceManager resourceManager;
            List<ProjectReportInfo> resources;
            try
            {
                Logger.Info();
                resourceManager = new Demo.Services.Services.Impl.Managers.ResourceManager();
                resources = (List<ProjectReportInfo>)resourceManager.GetResourceAssignment();
                var store = Chart1.GetStore();
                store.DataSource = resources;
                store.DataBind();
                Chart1.DataBind();
            }
            catch (Exception ex)
            {
                Logger.Error(ex);
                throw new UnhandledException(MethodInfo.GetCurrentMethod(), ex);
            }


        }     
    }
}